//
// Created by haoy on 2017/6/30.
//

#ifndef MERGE_TRACK_HPP
#define MERGE_TRACK_HPP

#include <istream>
#include <list>
#include <streambuf>
#include <sstream>
#include <stdio.h>
#include <string>

#include "file.hpp"
#include "dimension.hpp"

class track {
public:
    track() {}
    track(const file& f, int tid) : id(tid), input_id(f.id), begin_ts(f.begin_ts), duration_ms(f.duration_ms) {}
    int input_id;
    int id;
    uint64_t begin_ts;
    uint64_t duration_ms;
};

class video_track : public track {
public:
    video_track() {}
    video_track(const file& f, int id, const dimension& dim)
            : track(f, id), dim(dim) {}
    dimension dim;
};

class video_filter_track {
public:
    video_filter_track() {}
    video_filter_track(const std::string& filter, const dimension& dim, uint64_t beg_tm, uint64_t dur)
            : filter(filter), dim(dim), begin_ts(beg_tm), duration_ms(dur) {}
    std::string filter;
    dimension dim;
    uint64_t begin_ts = 0;
    uint64_t duration_ms = 0;
};

class audio_track : public track {
public:
    audio_track() {}
    audio_track(const file& f, int id, int sample_rate, int channels)
            : track(f, id), sample_rate(sample_rate), channels(channels) {}
    int sample_rate;
    int channels;
    // std::string channel_layout;
};

class audio_filter_track {
public:
    audio_filter_track() {}
    audio_filter_track(const std::string& filter, uint64_t begin_ts, uint64_t duration_ms)
            : filter(filter), begin_ts(begin_ts), duration_ms(duration_ms) {}
    std::string filter;
    uint64_t begin_ts = 0;
    uint64_t duration_ms = 0;
    int channel_nb = 2;
};

#endif //MERGE_TRACK_HPP
